package com.kclm.se.jcf;
/******
 * <p>二叉查找树的节点结构</p>
 * @author yejf
 * @since JDK8.0
 * @CreateDate 2020年8月14日 下午4:29:20 
 * @description 此类用来描述了xxxxx
 *
 */
public class Node<T extends Comparable<T>> {

	/** 节点中的数据 */
	private T data;
	
	/** 左孩子 */
	private Node<T> left;
	
	/** 右孩子 */
	private Node<T> right;

	/**
	 * @return the data
	 */
	public T getData() {
		return data;
	}

	/**
	 * @param data the data to set
	 */
	public void setData(T data) {
		this.data = data;
	}

	/**
	 * @return the left
	 */
	public Node<T> getLeft() {
		return left;
	}

	/**
	 * @param left the left to set
	 */
	public void setLeft(Node<T> left) {
		this.left = left;
	}

	/**
	 * @return the right
	 */
	public Node<T> getRight() {
		return right;
	}

	/**
	 * @param right the right to set
	 */
	public void setRight(Node<T> right) {
		this.right = right;
	}

	/**
	 * @param data
	 */
	public Node(T data) {
		this.data = data;
	}

	/**
	 * 
	 */
	public Node() {
	}

	@Override
	public String toString() {
		StringBuilder builder = new StringBuilder();
		builder.append("Node [data=").append(data).append("]");
		return builder.toString();
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((data == null) ? 0 : data.hashCode());
		return result;
	}

	@SuppressWarnings("rawtypes")
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Node other = (Node) obj;
		if (data == null) {
			if (other.data != null)
				return false;
		} else if (!data.equals(other.data))
			return false;
		return true;
	}
	
	
}